<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class SpecValue extends Model
{
    protected $table = 'product_specs_values';

    public $primaryKey = 'spec_value_id';

    //关联规格组表
    public function spec()
    {
        return $this->belongsTo(Spec::class, 'spec_id', 'spec_id');
    }

    // 关联商品
    public function product()
    {
        return $this->belongsToMany(Product::class, 'product_spec_value_rels', 'spec_value_id', 'product_id');
    }
}
